package com.qf.test;

import com.qf.pojo.User;
import org.junit.Test;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/*
 *@Description:
 *@author:刘哥
 *@Date:86180 2022/8/25 16:21
 */
public class Demo {
    @Test
    public void test01() {
//        读取配置文件，关联上下文
        ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml");
        User user = (User) context.getBean("user");
        User shenzhiheng = (User) context.getBean("shenzhiheng");
        System.err.println(user);
        System.out.println(shenzhiheng);

    }

    @Test
    public void test02() {
//        读取配置文件，关联上下文
        ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml");
        User user = context.getBean(User.class);
        user.add();
        System.out.println("user = " + user);

    }
}
